<?php
class AuthAction extends Action{
	public function auto(){
		$appID='112denglB0w6Nc0hdiK4lnA8mtXM15';
		$apiKey='58386112boM9XcE8J7P8dbb1lFZDA6';
		$charset='utf-8';
		import('@.ORG.Denglu.php');
		$api = new Denglu($appID,$apiKey,$charset);
		return $api;
	}
	
	public function index(){
		$api=$this->auto();
		$userInfo = $api->getUserInfoByToken($_GET['token']);
		if($userInfo){
			$_SESSION['uid']=$userInfo['mediaUserID'];
			$_SESSION['jointime']=strtotime($userInfo['createTime']);
			$_SESSION['email']=$userInfo['email'];
			$_SESSION['sex']=$userInfo['gender'];
			$this->redirect('/');
			//$this->redirect('/index.php/Home/Auth/');
		}else{//获取异常后的处理办法(请自定义)
			return false;		
			echo $api->geterrorCode();  //返回错误编号
			echo $api->geterrorDescription();  //返回错误信息
		}
	}
	
	public function reg(){
	
	}
	public function insert(){
		
	}
}
?>